package scjp.preparation.stringprocessing;

public class Search {

	public static void main(String[] args) {
		String s = new String("Hello!");
		System.out.println("Searching value of \"H\" in " + s.indexOf("H"));
		
		String str = "I am a student. I am preparing for OCPJP";
		int fromIndex = 0;
		while(str.indexOf("am", fromIndex) > -1) {
		fromIndex = str.indexOf("am", fromIndex);
		System.out.println("Substring \"am\" occurs at index: " + fromIndex);
		fromIndex++;
		}
		
		if(str.startsWith("I"))
			System.out.println("True");
		if(str.endsWith("OCPJP"))
			System.out.println("Ending with OCPJP");
		
		
	}
}
